package com.hnx.admin.common.security.handler;

import com.hnx.admin.common.security.utils.JSONUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;
@Component
@RequiredArgsConstructor
public class AuthenticationFailureImpl implements AuthenticationFailureHandler {
    private final JSONUtil jsonUtil;
    @Override
    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) {
        jsonUtil.printFail(request,response,exception.getMessage());
    }
}
